package vip.youngboy.freejump.persist.bus.buscol;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import vip.youngboy.freejump.domain.bus.BusColumn;
import vip.youngboy.freejump.repository.BusColRepository;

import java.util.List;

@Component
public class DefaultBusColPersistence implements BusColPersistence {

    @Autowired
    private BusColRepository busColRepository;

    @Override
    public void removeByTableId(String tableId) {
        busColRepository.deleteByBusTable_Id(tableId);
    }

    @Override
    public List<BusColumn> getByTableId(String tableId) {
        return busColRepository.findAllByBusTable_Id(tableId);
    }
}
